package com.example.libraryaccount.model.service



import com.example.lib_net.RetrofitFactory
import com.example.lib_net.entity.ResponseEntity
import com.example.libraryaccount.model.api.AccountApi
import com.example.libraryaccount.model.entity.AccountEntity
import retrofit2.http.GET
import retrofit2.http.PUT
import retrofit2.http.Query

/**
 * @author ytx 
 * @createDate 2023/11/10 14:46
 * @description
 *
 * @updateUser ytx
 * @updateDate 2023/11/10 14:46
 * @updateRemark
 *
 * @version 1.0.0
 */
class AccountService {
    val api:AccountApi

    init
    {
        api= RetrofitFactory.getRetrofitFactory().create(AccountApi::class.java)
    }

    /**
     * 根据账号id获取账户信息
     */
    suspend fun findAccountById(id:Int): ResponseEntity<AccountEntity> {
        return api.findAccountById(id)
    }

    /**
     * 根据用户id获取账户信息
     */
    suspend fun findAccountByUserId(userid:Int): ResponseEntity<AccountEntity>{
        return api.findAccountByUserId(userid)
    }

    /**
     * 修改金币金额
     */
    suspend fun modifyCoinAmount(id:Int, nm:Int):ResponseEntity<Boolean>{
        return api.modifyCoinAmount(id,nm)
    }
}